package snafu.utility;

import snafu.framework.exceptions.SnafuException;


public class Cast {

	@SuppressWarnings({ "unchecked", "unused" })
	public static <V> V cast(Object object, Class<V> clazz) {
		try {
			V v = (V) object;
		} catch (ClassCastException e) {
			throw new SnafuException("The object " + object + " is no instance of the class " + clazz, e);
		}
		
		return (V) object;
	}
	
}
